home *** CD-ROM | disk | FTP | other *** search
Wrap
rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) NNNNaaaammmmeeee rw_hashmultimap - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/rwstl/hashmmap.h> rw_hashmultimap<K,V,Hash,EQ> mmap; DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Class rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> maintains a collection of mappings between KKKK and VVVV, implemented as a hash table of ppppaaaaiiiirrrr<<<<ccccoooonnnnsssstttt KKKK,,,,VVVV>>>> in which there may be many pairs with the same KKKK instance. Since this is a vvvvaaaalllluuuueeee based collection, objects are ccccooooppppiiiieeeedddd into and out of the collection. As with all classes that meet the ANSI aaaassssssssoooocccciiiiaaaattttiiiivvvveeee ccccoooonnnnttttaaaaiiiinnnneeeerrrr specification, rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp provides for iterators that reference its elements. Operations that alter the contents of rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp may invalidate other iterators that reference the container. Since the contents of rrrrwwww____hhhhaaaasssshhhhmmmmaaaapppp are in pseudo-random order, the only iterator ranges that will usually make sense are the results of calling eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee((((kkkkeeeeyyyy)))), and the entire range from bbbbeeeeggggiiiinnnn(((()))) to eeeennnndddd(((()))). PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None PPPPuuuubbbblllliiiicccc TTTTyyyyppppeeeeddddeeeeffffssss typedef K key_type; typedef Hash key_hash; typedef EQ key_equal; typedef pair<K,V> value_type; // or ... "const K" typedef (unsigned) size_type; //from rw_slist typedef (int) difference_type; // from rw_slist typedef (value_type&) reference; typedef (const value_type&) const_reference; //from rw_slist Iterators over rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> are forward iterators. typedef (scoped Iterator) iterator; typedef (scoped ConsIterator) const_iterator; PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(size_type sz = 1024, const Hash& h = Hash(), const EQ& eq = EQ()); Construct an empty rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as the hash object, and eeeeqqqq as the equality comparator. PPPPaaaaggggeeee 1111 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const rw_hashmultimap<K,V,Hash,EQ>& mmap); Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> which is a copy of mmmmmmmmaaaapppp. Each element from mmmmmmmmaaaapppp will be copied into self. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const_iterator first, const_iterator bound size_type sz=1024, const Hash& h = Hash(), const EQ& eq = EQ()); Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as the hash object, and eeeeqqqq as the equality comparator, containing a copy of each pair referenced by the range starting with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd. rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(const value_type* first, const value_type* bound size_type sz=1024, const Hash& h = Hash(), const EQ& eq = EQ()); Construct an rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>> with sssszzzz slots, using hhhh as the hash object, and eeeeqqqq as the equality comparator, containing a copy of each pair referenced by the range starting with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd. PPPPuuuubbbblllliiiicccc DDDDeeeessssttttrrrruuuuccccttttoooorrrr ~~~~rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,VVVV,,,,HHHHaaaasssshhhh,,,,EEEEQQQQ>>>>(); The destructor releases the memory used by the container's implementation. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss rw_hashmultimap<K,V,Hash,EQ>& ooooppppeeeerrrraaaattttoooorrrr====(const rw_hashmultimap<K,V,Hash,EQ>& rhs); Sets self to have the same capacity, HHHHaaaasssshhhh and EEEEQQQQ as rrrrhhhhssss, removes all self's current contents, and replaces them with copies of the elements in rrrrhhhhssss. bool ooooppppeeeerrrraaaattttoooorrrr========(const rw_hashmultimap<K,V,Hash,EQ> & rhs) const; Returns true if self and rrrrhhhhssss have the same number of elements, and for each vvvvaaaalllluuuueeee____ttttyyyyppppeeee in self, there is exactly one corresponding vvvvaaaalllluuuueeee____ttttyyyyppppeeee in rrrrhhhhssss that has a first part for which the EEEEQQQQ object in self returns true, PPPPaaaaggggeeee 2222 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) and a second part for which ooooppppeeeerrrraaaattttoooorrrr========(((()))) returns true. The need to test both parts, and ensure that the matches are one-to-one means that this operator may be significantly slower than the method eeeeqqqquuuuaaaallll____bbbbyyyy____kkkkeeeeyyyyssss(((()))) described below. AAAAcccccccceeeessssssssoooorrrrssss iterator bbbbeeeeggggiiiinnnn(); The iterator returned references the first item in self. If self is empty, the iterator is equal to eeeennnndddd(((()))). Note that because items are stored in pseudo-random order, this iterator might reference any item that has been stored in self. const_iterator bbbbeeeeggggiiiinnnn() const; The iterator returned references the first item in self. If self is empty, the iterator is equal to eeeennnndddd(((()))). Note that because items are stored in pseudo-random order, this iterator might reference any item that has been stored in self. iterator eeeennnndddd(); The iterator returned marks the location "off the end" of self. It may not be dereferenced. const_iterator eeeennnndddd() const; The iterator returned marks the location "off the end" of self. It may not be dereferenced. pair<const_iterator, const_iterator> eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee(const key_type key) const; Returns ppppaaaaiiiirrrr<<<<ccccoooonnnnsssstttt____iiiitttteeeerrrraaaattttoooorrrr,,,,ccccoooonnnnsssstttt____iiiitttteeeerrrraaaattttoooorrrr>>>>((((lllloooowwwweeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))),,,, uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))))))). Upper and lower bound have special meaning for hash- based collections. See discussion elsewhere. pair<iterator, iterator> eeeeqqqquuuuaaaallll____rrrraaaannnnggggeeee(const key_type key); Returns ppppaaaaiiiirrrr<<<<iiiitttteeeerrrraaaattttoooorrrr,,,,iiiitttteeeerrrraaaattttoooorrrr>>>>((((lllloooowwwweeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))),,,, uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd((((kkkkeeeeyyyy)))))))). Upper and lower bound have special meaning for hash-based collections. PPPPaaaaggggeeee 3333 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) See discussion elsewhere. const_iterator lllloooowwwweeeerrrr____bbbboooouuuunnnndddd(const key_type& key) const; Returns the lower bound of kkkkeeeeyyyy in self. This has a special meaning for hash-based collections. See discussion elsewhere. iterator lllloooowwwweeeerrrr____bbbboooouuuunnnndddd(const key_type& key); Returns the lower bound of kkkkeeeeyyyy in self. This has a special meaning for hash-based collections. See discussion elsewhere. const_iterator uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd(const key_type& key) const; Returns the upper bound of kkkkeeeeyyyy in self. This has a special meaning for hash-based collections. See discussion elsewhere. iterator uuuuppppppppeeeerrrr____bbbboooouuuunnnndddd(const key_type& key); Returns the upper bound of kkkkeeeeyyyy in self. This has a special meaning for hash-based collections. See discussion elsewhere. CCCCoooonnnnsssstttt PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss size_type ccccaaaappppaaaacccciiiittttyyyy() const; Returns the number of slots in the hash table that self uses. bool eeeemmmmppppttttyyyy() const; Returns ttttrrrruuuueeee if self is empty. float ffffiiiillllllll____rrrraaaattttiiiioooo() const; Returns the result of calculating ssssiiiizzzzeeee(((())))////ccccaaaappppaaaacccciiiittttyyyy(((()))). size_type ssssiiiizzzzeeee() const; PPPPaaaaggggeeee 4444 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) Returns the number of items currently held in self. MMMMuuuuttttaaaattttoooorrrrssss void cccclllleeeeaaaarrrr(); A synonym for eeeerrrraaaasssseeee((((bbbbeeeeggggiiiinnnn(((()))),,,,eeeennnndddd(((())))))));;;; size_type eeeerrrraaaasssseeee(const key_type& key); Removes all pairs in self for which the first part is EEEEQQQQ to kkkkeeeeyyyy, and returns the number of removed elements. iterator eeeerrrraaaasssseeee(iterator iter); Removes the element referenced by iiiitttteeeerrrr and returns an iterator referencing the "next" element. If iiiitttteeeerrrr does not reference an item in self, the result is undefined. iterator eeeerrrraaaasssseeee(iterator first, iterator bound); Removes each element in the range which begins with ffffiiiirrrrsssstttt and is bound by bbbboooouuuunnnndddd. Returns an iterator referencing bbbboooouuuunnnndddd. If ffffiiiirrrrsssstttt does not reference an item in self (and if ffffiiiirrrrsssstttt and bbbboooouuuunnnndddd are not equal), the effect is undefined. pair<iterator,bool> iiiinnnnsssseeeerrrrtttt(const value_type& val); Inserts the pair, vvvvaaaallll, and returns a pair with an iterator referencing the new element and ttttrrrruuuueeee. size_type iiiinnnnsssseeeerrrrtttt(iterator ignore, const value_type& val); Inserts the pair, vvvvaaaallll, returning 1111. Note that the first argument is provided only for conformance with the ANSI aaaassssssssoooocccciiiiaaaattttiiiivvvveeee ccccoooonnnnttttaaaaiiiinnnneeeerrrr specification, and is ignored by the method, since hash table look up can be done in constant time. size_type iiiinnnnsssseeeerrrrtttt(const value_type* first, const value_type* bound); PPPPaaaaggggeeee 5555 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) For each element in the range beginning with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd, the element is copied into self. Returns the number of elements inserted. size_type iiiinnnnsssseeeerrrrtttt(const_iterator first, const_iterator bound); For each element in the range beginning with ffffiiiirrrrsssstttt and bounded by bbbboooouuuunnnndddd, the element is copied into self. Returns the number of elements inserted. void sssswwwwaaaapppp(rw_hashmultimap<K,V,Hash,EQ>& other); Exchanges the contents of self with ooootttthhhheeeerrrr including the HHHHaaaasssshhhh and EEEEQQQQ objects. This method does not copy or destroy any of the items exchanged but exchanges the underlying hash tables. SSSSppppeeeecccciiiiaaaallll MMMMeeeetttthhhhooooddddssss ffffoooorrrr MMMMuuuullllttttiiiimmmmaaaappppssss size_type ccccoooouuuunnnntttt(const key_type& key) const; Returns the number of pairs in self which have kkkkeeeeyyyy EEEEQQQQ to their first element. bool eeeeqqqquuuuaaaallll____bbbbyyyy____kkkkeeeeyyyyssss(const rw_hashmultimap<K,V,Hash,EQ>& rhs) const; Returns true if self and rrrrhhhhssss have the same size, and if for each distinct kkkkeeeeyyyy____ttttyyyyppppeeee in self, self and rrrrhhhhssss have the same number of pairs with first parts that test EEEEQQQQ to that instance. Note that this method does not compare the VVVV (second) part of the pair of the items, so it will run slightly faster than ooooppppeeeerrrraaaattttoooorrrr========(((()))). const_iterator ffffiiiinnnndddd(const key_type& key) const; Returns a const_iterator referencing some pair with kkkkeeeeyyyy as its first element, if such a pair is contained in self, else returns eeeennnndddd(((()))). iterator ffffiiiinnnndddd(const key_type& key); Returns an iterator referencing some pair with kkkkeeeeyyyy as its first element, if such a pair is contained in self, else returns eeeennnndddd(((()))). PPPPaaaaggggeeee 6666 rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) rrrrwwww____hhhhaaaasssshhhhmmmmuuuullllttttiiiimmmmaaaapppp((((3333CCCC++++++++)))) void rrrreeeessssiiiizzzzeeee(size_type sz); Resizes self's hash table to have sssszzzz slots; and re-hashes all self's elements into the new table. Can be very expensive if self holds many elements. PPPPaaaaggggeeee 7777